package com.hsd.znsh.repository;

import com.hsd.znsh.entity.Role;
import com.hsd.znsh.entity.RoleFunction;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/*
 * @auther: wangjiacai
 *
 * @create: 2018-05-07 18:18:17
 */
public interface RoleFunctionRepository extends JpaRepository<RoleFunction,Integer> {

    @Query("select functionId from RoleFunction where roleId in (?1)")
    List<Integer> findFunctionIdListByRoleIdIn(List<Integer> roleIds);

    @Query("select functionId from RoleFunction where roleId = ?1")
    List<Integer> findFunctionIdListByRoleId(Integer roleId);

    void deleteByRoleId(Integer roleId);

    void deleteByFunctionId(Integer functionId);
}
